
#ifndef RECOMMEND_TEST_H
#define RECOMMEND_TEST_H
#include "../../recall/UserLabelRecall.h"
namespace test {

    TEST(TestRecall, TestMerge) {
        vector< ItemUtil::LinkedItems*> vs;
        vs.resize(3);
        {
            ItemUtil::LinkedItemsList ll(new ItemUtil::Item(111, 0.11, "tag2_12", "tag3_123"), 10);
            ll.insert(new ItemUtil::Item(111, 0.21, "tag2_12", "tag3_123"));
            ll.insert(new ItemUtil::Item(111, 0.41, "tag2_12", "tag3_123"));
            ll.insert(new ItemUtil::Item(111, 0.31, "tag2_12", "tag3_123"));
            vs[0] = ll.head_;

            ItemUtil::LinkedItemsList l2(new ItemUtil::Item(111, 0.12, "tag2_12", "tag3_123"), 10);
            l2.insert(new ItemUtil::Item(111, 0.22, "tag2_12", "tag3_123"));
            l2.insert(new ItemUtil::Item(111, 0.42, "tag2_12", "tag3_123"));
            l2.insert(new ItemUtil::Item(111, 0.32, "tag2_12", "tag3_123"));
            vs[1] = l2.head_;

            ItemUtil::LinkedItemsList l3(new ItemUtil::Item(111, 0.13, "tag2_12", "tag3_123"), 10);
            l3.insert(new ItemUtil::Item(111, 0.23, "tag2_12", "tag3_123"));
            l3.insert(new ItemUtil::Item(111, 0.43, "tag2_12", "tag3_123"));
            l3.insert(new ItemUtil::Item(111, 0.33, "tag2_12", "tag3_123"));
            vs[2] = l3.head_;

            vector<ItemUtil::Item*>* ret = UserLabelRecall::multiMergeSequceList(vs, 3);
            //cout << ret->at(0)->score << ret->at(1)->score << ret->at(2)->score << endl;
            EXPECT_EQ(0.43, ret->at(0)->score);
            EXPECT_EQ(0.42, ret->at(1)->score);
            EXPECT_EQ(0.41, ret->at(2)->score);

            ret->clear(); delete ret;
        }
        EXPECT_EQ(0, ItemUtil::Item::count_);
        EXPECT_EQ(0, ItemUtil::LinkedItems::count_);
        EXPECT_EQ(0, ItemUtil::LinkedItemsList::count_);
    }

}

#endif